#!/usr/bin/env node
const superagent = require('superagent')
const urlencode = require('urlencode')
var inquirer = require('inquirer')

var questions = [
  {
    type: 'input',
    name: 'star',
    message: "请输入要查询的星座：",
  }
];
inquirer.prompt(questions).then((answers) => {
  console.log('\n');
  superagent
  .get(`http://web.juhe.cn:8080/constellation/getAll?key=1e86cbe4ac7c8e1d23dcc5a133221f7b&type=today&consName=${urlencode(answers.star)}`)
  .set('accept', 'json')
  .end((error, res) => {
      console.log(JSON.parse(res.text))
});
});

